home *** CD-ROM | disk | FTP | other *** search
-
- /*
- * A C-style linked list structure definition
- */
-
- struct name_list_t {
- char name[61];
- char addr[101];
- struct name_list_t *next;
- struct name_list_t *prev;
- };
- struct name_list_t *name_top; /* head of list */
- struct name_list_t *name_bot; /* end of list */
-
- /*
- * A code fragment that adds an entry to a linked list.
- */
-
- struct name_list_t *entry;
-
- entry = (struct name_list_t *)malloc(sizeof(name_list_t));
- strcpy(entry->name, new_name);
- strcpy(entry->addr, new_addr);
- if (name_top = NULL)
- name_top = entry;
- if (name_bot ! = NULL)
- name_bot -> next = entry;
- entry->prev = name_bot;
- entry->next = NULL;
- name_bot = entry
-
-
-